<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>购物车-当当网</title>
    <link href="<%=basePath%>css/shopping_cart_new.css" rel="stylesheet" type="text/css">
	<link href="<%=basePath%>css/header_960_150611.css" rel="stylesheet" type="text/css">
</head>

<body style="padding-bottom:82px">
	<!-- 页面顶部 -->
	<div id="hd">
		<div id="tools">
			<div class="tools">
				<div class="ddnewhead_operate" dd_name="顶链接">
					<div class="ddnewhead_welcome" display="none;"></div>
					<div class="new_head_znx" id="znx_content" style="display:none;"></div>
				</div>
			</div>
		</div>
		<div id="header_end"></div>
	</div>

	<script type="text/javascript">var nick_num = 0;initHeaderOperate();</script>
		
	<!-- 我的购物车文字 -->
	<div class="logo_line">
		<div class="w960">
			<div class="shopping_procedure">
				<span class="current">我的购物车</span>
			</div>
			<div class="logo">
				<a href="<%= basePath %>getShoppingCart/${sessionScope.user.username}">
					<img src="<%=basePath%>images/dd_logo.jpg" alt="购物车logo">
				</a>
			</div>
		</div>
	</div>
	
	<!-- 配送地址：写死 -->
	<div class="add_line" id="district">
		<div class="w960">
			<div class="address" id="dp_adress">
				<span class="icon_adr">&nbsp;</span>
				配送地址：
				<div class="select_add">
					<span class="text fn-select-address">山西太原市小店区城区</span>
				</div>
			</div>
		</div>
	</div>
	
	<div class="w960" id="showTip"></div>
	
	<!-- 中央表格 -->
	<div class="w960" id="cart">
		<div id="LoginFalse" class="login_tip">
		
		<!-- 欢迎光临当当 文字 -->
		<span class="icon"></span>
			欢迎光临当当
		</div>
		
		<!-- 中央表格 -->
		<div class="fn-shops" id="J_cartContent">
			<div class="fn-shop">
				<div class="shopping_list">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<!-- 表头 -->
						<thead>
							<tr>
								<td>商品图片</td>
								<td>商品名称</td>
								<td>单价（元）</td>
								<td>购买数量</td>
								<td>单项计价</td>
								<td>操作</td>
							</tr>
						</thead>
					
						<!-- 某个商品的信息 -->
						<tbody>
							<!-- 迭代购物车信息 -->
							<c:forEach items="${sessionScope.shoppingcart}" var="entry">
								<tr id="tr_383082636" class="bb_none tree_line ">
									<!-- 商品图片 -->
									<td class="row_img">
										<a href="<%= basePath %>detail/${entry.key.gid}" target="_blank" dd_name="查看详情">
											<img src="<%=basePath%>${entry.key.gimg}" width="80" height="80">
										</a> 
									</td>
									
									<!-- 商品名称 -->
									<td class="row_name">
										<div class="name">
											<a href="<%= basePath %>detail/${entry.key.gid}" 
												title="商品名称" target="_blank" dd_name="查看详情" 
												style="word-break:break-all;  word-wrap:break-word;">
												${entry.key.gname}
											</a>
										</div>
									</td>
									
									<!-- 商品单价 -->
									<td class="row3">
										<span>
											¥
											<fmt:formatNumber maxFractionDigits="2">
												${entry.key.gprice}
											</fmt:formatNumber>
										</span>
									</td>
									
									<!-- 购买数量 -->
									<td data-minbuy="0" class="fn-count-tip row3 ">
										<span class="amount fn-updatecount " data-value="1">
											<a dd_name="减少数量" href="<%= basePath%>delone${entry.key.gid}">-</a>
											<input data-value="1" value="${entry.value}" type="text">
											<a dd_name="增加数量" href="<%= basePath%>addone${entry.key.gid}">+</a>
										</span>
									</td>
									
									<!-- 单项计价 -->
									<td class="row4">
										<span>
											¥
											<fmt:formatNumber maxFractionDigits="2">
												${entry.key.gprice * entry.value}
											</fmt:formatNumber>
										</span>
									</td>
									
									<!-- 操作 -->
									<td class="row5 ">
										<span>
											<a href="<%= basePath %>del${entry.key.gid}" data-item="383082636" 
												class="fn-remove-product" dd_name="删除普通品">
												删除
											</a>
										</span>
									</td>
								</tr>
							</c:forEach>
						</tbody>
						
						<!-- 总价格 -->
						<tfoot>
							<tr class="total">
								<td class="row1">&nbsp;</td>
								<td class="row_img">店铺合计</td>
								<td colspan="2">&nbsp;</td>
								<td colspan="3" class="row4">
									<span class="red big ooline alignright">
										¥
										<fmt:formatNumber maxFractionDigits="2">
											${cost}
										</fmt:formatNumber>
									</span>
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
				
				<div class="shipping_add" style="display:none;"></div>
			</div>
		</div>
	</div>
	
	<div id="hide_div" style="height:0px;visibility:hidden;"></div>
	
	<!-- 页面底部的数据 -->
	<div style="position: fixed; bottom: -20px; z-index: 101; width: 100%; left: 0px;">
		<div class="shopping_total" id="J_totalMoneyBlock">
			<div class="shopping_total_right">
				<a class="total_btn fn-checkout" href="<%= basePath %>pay" 
					id="checkout_btn" dd_name="结算">结&nbsp;&nbsp;算</a>
				<div class="subtotal">
					<p>
						<span class="cartsum">总计(不含运费)：</span>
						<span id="payAmount" class="price">
							¥
							<fmt:formatNumber maxFractionDigits="2">
								${cost}
							</fmt:formatNumber>
						</span>
					</p>
					<p>
						<span class="cartsum">已节省：</span>
						<span id="totalFavor">¥0.00</span>
					</p>
				</div>
			</div>
		</div>
	</div>
	
	<!-- 如果购物车是空的，显示以下提示 -->
	<div class="w960">
		<div class="empty" id="empty" style="display: none;">
			<p>您的购物车还是空的，您可以：</p>
			<a href="登录链接" class="btn">立即登录</a>
			登录后购物车的商品将保存到您的账号中，或者
			<a href="指向首页">去逛逛</a>
		</div>
    
    	<div class="shopping_ads" id="fn-recent-view" style="display: none;"></div>
	</div>
	
	<div class="mmz_float_curve gwd_ns_right" style="left: 796.5px; top: 868.5px;">
		<div class="gwd_float_curve_holder" style="opacity:1;">
			<div class="gwd_float_curve_wrapper_plot">
				<div class="mmz_float_curve_main"></div>
			</div>
		</div>
		
		<span class="gwd_float_curve_triangle" style="top: 93.5px;"></span>
	</div>
</body>

</html>